import {request} from 'umi';
// 获取数据
export const getSearchList = (page:number,pageSize=12) => {
    return request('/api/search',{
        method:'GET',
        params:{
            page,pageSize
        }
    })
    
}
// 删除
export const delSearchList = (params:string) => {
    return request(`/api/search/${params}`,{
        method:'DELETE'        
    })
    
}

// 搜索

interface IOptions {
    [params:string]:string;
}
interface ISearchParams {
    page:number;
    options: IOptions
}
export const selectSearchList = (params:ISearchParams,pageSize=12) => {
    let str = '';
    for(let key in params.options){
        if(params.options[key]){
            str = str + '&' + key + '=' + params.options[key] ;
        }
    }
    return request(`/api/search?page=${params.page}&pageSize=${pageSize}${str}`,{
        method:'GET',         
    })
    
}